﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace GUI
{
    /// <summary>
    /// Interaction logic for ScriptSelector.xaml
    /// </summary>
    public partial class ScriptSelectorDialog : Window
    {
        public ScriptSelectorDialog(Window owner, IEnumerable<String> options)
        {
            Owner = owner;
            InitializeComponent();
            Confirm.IsDefault = true;
            foreach (String option in options)
            {
                //ComboBoxItem item = new ComboBoxItem();
                ScriptSelector.Items.Add(option);
            }
        }

        private void Confirm_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
            Close();
        }

        public String Return { 
            get {
                if (ScriptSelector.SelectedItem == null || ScriptSelector.SelectedItem.ToString().Contains("Select a script..."))
                {
                    return null;
                }
                return ScriptSelector.SelectedItem.ToString(); 
            } 
        }
    }
}
